package com.jdk8.demo.date;

import java.time.*;
import java.time.temporal.ChronoUnit;

public class LocalDateTimeTest {
    public static void main(String[] args) {
        LocalDateTime localDateTime = LocalDateTime.of(2018, Month.MARCH,
                18, 23, 34, 10);
        System.out.println(localDateTime);
        LocalDateTime dateTime = LocalDateTime.of(LocalDate.of(2017, 10, 1),
                LocalTime.of(10, 20, 30));
        System.out.println(dateTime);
        System.out.println(dateTime.toLocalDate());
        System.out.println(dateTime.toLocalTime());

        System.out.println("-----------------------");

        Duration timeDuration = Duration.between(LocalTime.of(10, 0, 0),
                LocalTime.of(11, 0, 0));
        System.out.println(timeDuration.get(ChronoUnit.SECONDS));


    }
}